package club.tclyq.good_time.photowall.show.controller;

import club.tclyq.good_time.photowall.show.service.ShowPhotoService;
import club.tclyq.good_time.upload.bean.Photo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;
import java.util.List;
import java.util.Map;

/**
 * @author tanchong
 * Create Date: 2019/2/24
 */
@RestController
@RequestMapping("/api/v1/show_photo")
public class ShowPhotoController {

    private ShowPhotoService showPhotoService;

    @Autowired
    public ShowPhotoController(ShowPhotoService showPhotoService) {
        this.showPhotoService = showPhotoService;
    }

    @GetMapping
    public Map<String, List<Photo>> getPhotoToPage(HttpServletRequest request){
        String lastPhotoId = request.getParameter("lastPhotoId");
        System.out.println(" lastPhotoId ::" + lastPhotoId);
        return showPhotoService.getPhotoToPage(request);
    }
}
